/**
 * @author wayne
 * @Since  2015
 * 
 * modify by chan on 2016-08-24
 */
package com.wealth.payment.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import com.wealth.system.entity.Corporation;

@Entity
@Table(name = "payment_account")
public class PaymentAccount implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	//alias
	public static final String ALIAS_PARTNERID = "微信（支付宝）支付分配的商户号";
	public static final String ALIAS_PAYSERVICE = "微信（支付宝）支付分配商户的初始密钥";
	public static final String ALIAS_SELLERID = "支付宝支付：卖家支付宝用户号";
	public static final String ALIAS_PAYMODE = "支付方式，1：支付宝，2：微信支付，3：其他（免费）";

	private Long id;
	private String partnerid;
	private String payservice;
	private String sellerid;
	private Integer paymode;
	private String creator;
	private Date createtime;
	private Integer status;
	private Corporation corp;
	
	/* ---------------- method ----------------*/
	public PaymentAccount(){}

	public PaymentAccount(Long id){
		this.id = id;
	}

	/* ---------------- getter/setter ----------------*/

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	public String getPartnerid() {
		return partnerid;
	}

	public void setPartnerid(String partnerid) {
		this.partnerid = partnerid;
	}

	public String getPayservice() {
		return payservice;
	}

	public void setPayservice(String payservice) {
		this.payservice = payservice;
	}

	public String getSellerid() {
		return sellerid;
	}

	public void setSellerid(String sellerid) {
		this.sellerid = sellerid;
	}

	public Integer getPaymode() {
		return paymode;
	}

	public void setPaymode(Integer paymode) {
		this.paymode = paymode;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	@Column(name="create_time")
	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@ManyToOne
	@JoinColumn(name="corp_id")
	public Corporation getCorp() {
		return corp;
	}

	public void setCorp(Corporation corp) {
		this.corp = corp;
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof PaymentAccount == false) return false;
		if(this == obj) return true;
		PaymentAccount other = (PaymentAccount)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
}

